The exemplary embodiments disclosed herein relate to an image processing program and an image processing device and, more particularly, to an image processing program and an image processing device for detecting a collision between objects in a virtual three-dimensional space.
Patent Document 1 (Japanese Laid-Open Patent Publication No. 7-230559) describes a conventional technique for performing a collision detection (also called “contact detection”) between objects in a video game where there are a plurality of objects (a player character, etc.) in a virtual three-dimensional space. This technique uses a plurality of spherical regions as regions defined for each object for the purpose of collision detection (“collision detection regions”). Specifically, an image processing device described in Patent Document 1 defines a plurality of spherical regions in each object, and calculates the degree of overlap between spherical regions of different objects using the center coordinates and the radii of the spheres. If the degree of overlap is greater than a predetermined value, it is determined that the objects have contacted each other. Thus, a collision detection can be performed by approximating each object by a plurality of spheres. Then, the amount of memory required for the collision detection can be reduced as compared with a case where each object is approximated by a quadrangular prism, whereby it is possible to increase the process speed and the accuracy of the collision detection.
In this conventional technique, the collision detection regions defined for each object have the same size. Therefore, with the conventional technique, the action to be executed upon collision between objects may not be rendered naturally (realistically). FIG. 17 shows an exemplary image of the virtual space displayed by using a conventional technique. In the example shown in FIG. 17, a tornado moves across the ground with a large number of fallen leaves 111. In this example, a collision detection region is defined for each fallen leaf 111 and the tornado, and a collision detection is performed between the fallen leaves 111 and the tornado. If the tornado contacts a fallen leaf 111, the process shows the fallen leaf 111 being swirled up by the tornado. Where the size of the collision detection region of the tornado is constant, the tornado swirls up the fallen leaves 111 on a path of a constant width equal to that of the collision detection region of the tornado. Therefore, after the tornado passes, the fallen leaves 111 along the band-shaped region A2 (see FIG. 18) of a constant width will be all blown away. However, it is unrealistic and seems unnatural to have all the fallen leaves 111 blown away from only the region of the constant width with the rest of the fallen leaves 111 all staying unblown. Thus, with the conventional technique, the action to be executed upon collision between objects may not be rendered naturally.
Therefore, a feature of certain exemplary embodiments is to provide an image processing program and an image processing device capable of controlling objects so that the action to be executed upon collision between objects is rendered more naturally.
The certain exemplary embodiments have the following features. Note that parenthetic expressions in the following section (reference numerals, supplementary explanations, etc.) are merely to indicate the correlation between what is described in the following section and what is described in the detailed description set out further below in the present specification, and are in no way intended to restrict the scope of the certain exemplary embodiments described herein.
A first aspect of certain exemplary embodiments is directed to a computer-readable storage medium storing an image processing program (the video game program 80) to be executed by a computer (the CPU 31) of an image processing device (the video game device 3) for displaying, on a display device (the TV 2), a virtual three-dimensional space where there are a plurality of objects (e.g., the tornado object 72 and the fallen leaf objects 73) each having a collision detection region defined therefor. The image processing program instructs the computer to perform a size-varying step (step S5), a collision detection step (step S6), and a display control step (step S9). In the size-varying step, the computer varies a size of the collision detection region (75) defined for a predetermined object (the tornado object 72) so that the size repeatedly increases and decreases over time, while the predetermined object is moving. In the collision detection step, the computer determines whether or not the predetermined object is being in contact with another object (the fallen leaf object 73) using the collision detection regions (75 and 76) thereof. In the display control step, the computer displays, on the display device, a predetermined effect (e.g., an object being blown away) being inflicted on the object determined to be in contact with the predetermined object.
In a second aspect of certain exemplary embodiments, a preliminary detection region (77), different from the collision detection region, may be defined for the predetermined object. The image processing program instructs the computer to further perform a preliminary detection step (steps S3 and S4). In the preliminary detection step, the computer determines whether or not the collision detection region defined for the other object and the preliminary detection region are in contact with each other. The size-varying step and the collision detection step are performed only when it is determined in the preliminary detection step that the collision detection region defined for the other object and the preliminary detection region are in contact with each other.
In a third aspect of certain exemplary embodiments, in the size-varying step, the computer may vary the size of the collision detection region with a predetermined time interval (e.g., once per frame).
In a fourth aspect of certain exemplary embodiments, in the size-varying step, the computer may vary the size of the collision detection region randomly within a predetermined range.
In a fifth aspect of certain exemplary embodiments, in the display control step, the computer may show a movement of the object determined to be in contact with the predetermined object to a position where the object is no longer in contact with the predetermined object, or the computer may change an appearance of the object.
The certain exemplary embodiments may be provided in the form of an image processing device capable of realizing similar functions to those realized by executing the image processing program as set forth above.
According to the first aspect, the collision detection region is varied in the size-varying step while the predetermined object is moving. Then, even if the predetermined object moves along a smooth path, the periphery of the area across which other objects are determined to be in contact with the predetermined object will be in an irregular shape, but not a smooth shape conforming to the path of the predetermined object. This prevents the periphery of the area from being unnaturally regular. Thus, it is possible to more naturally render an action to be executed upon collision.
According to the second aspect, the preliminary detection region is defined for the predetermined object, wherein the size of the collision detection region of the predetermined object is determined and the collision detection process is performed only when the preliminary detection region is in contact with the collision detection region of another object. Therefore, when it is not necessary to perform the process of determining the size of the collision detection region (e.g., when there is no other objects around the predetermined object), the process can be omitted, thereby reducing the processing load on the computer.
According to the third aspect, the size of the collision detection region is varied with a predetermined time interval. Then, it is no longer necessary to define a preliminary detection region, as in the second aspect, whereby it is possible to reduce the memory size, which needs to be provided in the image processing device.
According to the fourth aspect, the size of the collision detection region is varied randomly. Then, as compared with a case where it is varied with some regularity, it is possible to more naturally render an action to be executed upon collision.
According to the fifth aspect, the computer moves the other object determined to be in contact with the predetermined object (e.g., as if it were blown away as in the exemplary embodiment to be described below), or the computer changes the appearance of the other object (e.g., changes its shape as in the variation to be described below). Thus, it is possible to express the difference in the game space between the state of the area in contact with the predetermined object and that of the area not in contact with the predetermined object, in a manner readily understandable to the user.
These and other features, aspects and advantages of the certain exemplary embodiments described herein will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings.